package com.foreknow.web;

import javafx.scene.input.DataFormat;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Test {

    public static void main(String[] args) {
        SimpleDateFormat dataFormat = new SimpleDateFormat("yyyy-MM-dd");


        Calendar calendar = new GregorianCalendar();
        calendar.setFirstDayOfWeek(Calendar.MONDAY);
        int nextMon;
        int nextSun;
        if (calendar.get(Calendar.DAY_OF_WEEK) == 1) {
            nextMon = 1;
            nextSun = 7;
        } else {
            nextMon = 7 - calendar.get(Calendar.DAY_OF_WEEK) + 2;
            nextSun = 7 - calendar.get(Calendar.DAY_OF_WEEK) + 2 + 6;
        }

        calendar.add(Calendar.DAY_OF_MONTH, nextMon);

        System.out.println(dataFormat.format(calendar.getTime()));
        System.out.println(calendar.get(Calendar.DAY_OF_WEEK));


    }
}
